Cypress.on("uncaught:exception", () => {
  return false;
});

describe("机器人管理", () => {
  beforeEach(() => {
    const username = "admin";
    const password = "123456";
    cy.login(username, password);
    cy.visit("/");
    cy.getByData("sidebar-menu").contains("安保机器人").click();
    cy.get('[href="/inspection/robot-manage"] > .el-menu-item').click();
  });

  it("页面显示", () => {
    // 接口拦截
    cy.intercept(
      { method: "GET", url: "/api/robot-archives/v1/getRobotAndCompany*" },
      {
        statusCode: 200,
        body: {
          code: 200,
          message: "操作成功",
          data: {
            total: 1,
            list: [
              {
                id: 707,
                code: "I202211241955",
                password: null,
                productNum: null,
                mac: "48:21:0b:2d:16:fb",
                type: "inspection",
                version: "5.0",
                remark: "",
                chassis: "Turtle",
                name: "",
                status: "离线",
                companyId: null,
                createTime: "2022-11-24 16:13:48",
                usageTimes: 1,
                companyName: null,
              },
            ],
            pageNum: 1,
            pageSize: 10,
            size: 1,
            startRow: 1,
            endRow: 1,
            pages: 1,
            prePage: 0,
            nextPage: 0,
            isFirstPage: true,
            isLastPage: true,
            hasPreviousPage: false,
            hasNextPage: false,
            navigatePages: 8,
            navigatepageNums: [1],
            navigateFirstPage: 1,
            navigateLastPage: 1,
          },
        },
        headers: { "access-control-allow-origin": "*" },
      }
    ).as("getRobotAndCompany");
  });
});
